package com.supermap.sdc2023.guongquan.usersvc;

import com.google.common.collect.Iterables;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Component;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;

@Path(("/"))
@Component
public class UserResource {
    @GET
    public UserInfo getUserInfo(@Context Subject subject) {
        return Iterables.getOnlyElement(subject.getPrincipals().byType(UserInfo.class));
    }
}
